每天一个adb命令:pm 命令详解 您所在的位置:网站首页 adb grep命令详解 每天一个adb命令:pm 命令详解

每天一个adb命令:pm 命令详解

2023-10-23 00:52| 来源: 网络整理| 查看: 265

介绍adb shell中一个很重要的命令——pm(Package Manager),这个命令主要用于获取和安装在 Android 设备上的应用信息。 关于pm命令的用法解析。命令行下输入adb shell pm即可获得关于pm的用法帮助,如下所示:

usage: pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user USER_ID] [FILTER] pm list permission-groups pm list permissions [-g] [-f] [-d] [-u] [GROUP] pm list instrumentation [-f] [TARGET-PACKAGE] pm list features pm list libraries pm list users pm path PACKAGE pm dump PACKAGE pm install [-lrtsfd] [-i PACKAGE] [PATH] pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES] pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH] pm install-commit SESSION_ID pm install-abandon SESSION_ID pm uninstall [-k] [--user USER_ID] PACKAGE pm set-installer PACKAGE INSTALLER pm clear [--user USER_ID] PACKAGE pm enable [--user USER_ID] PACKAGE_OR_COMPONENT pm disable [--user USER_ID] PACKAGE_OR_COMPONENT pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT pm hide [--user USER_ID] PACKAGE_OR_COMPONENT pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT pm grant PACKAGE PERMISSION pm revoke PACKAGE PERMISSION pm set-install-location [0/auto] [1/internal] [2/external] pm get-install-location pm set-permission-enforced PERMISSION [true|false] pm trim-caches DESIRED_FREE_SPACE pm create-user [--profileOf USER_ID] [--managed] USER_NAME pm remove-user USER_ID pm get-max-users pm list packages: prints all packages, optionally only those whose package name contains the text in FILTER. Options: -f: see their associated file. -d: filter to only show disbled packages. -e: filter to only show enabled packages. -s: filter to only show system packages. -3: filter to only show third party packages. -i: see the installer for the packages. -u: also include uninstalled packages. pm list permission-groups: prints all known permission groups. pm list permissions: prints all known permissions, optionally only those in GROUP. Options: -g: organize by group. -f: print all information. -s: short summary. -d: only list dangerous permissions. -u: list only the permissions users will see. pm list instrumentation: use to list all test packages; optionally supply to list the test packages for a particular application. Options: -f: list the .apk file for the test package. pm list features: prints all features of the system. pm list users: prints all users on the system. pm path: print the path to the .apk of the given PACKAGE. pm dump: print system state associated with the given PACKAGE. pm install: install a single legacy package pm install-create: create an install session -l: forward lock application -r: replace existing application -t: allow test packages -i: specify the installer package name -s: install application on sdcard -f: install application on internal flash -d: allow version code downgrade -p: partial application install -S: size in bytes of entire session pm install-write: write a package into existing session; path may be '-' to read from stdin -S: size in bytes of package, required for stdin pm install-commit: perform install of fully staged session pm install-abandon: abandon session pm set-installer: set installer package name pm uninstall: removes a package from the system. Options: -k: keep the data and cache directories around after package removal. pm clear: deletes all data associated with a package. pm enable, disable, disable-user, disable-until-used: these commands change the enabled state of a given package or component (written as "package/class"). pm grant, revoke: these commands either grant or revoke permissions to applications. Only optional permissions the application has declared can be granted or revoked. pm get-install-location: returns the current install location. 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external]: Install on external media pm set-install-location: changes the default install location. NOTE: this is only intended for debugging; using this can cause applications to break and other undersireable behavior. 0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external]: Install on external media pm trim-caches: trim cache files to reach the given free space. pm create-user: create a new user with the given USER_NAME, printing the new user identifier of the user. pm remove-user: remove the user with the given USER_IDENTIFIER, deleting all data associated with that user

我仅举例说明一些常用的命令,详细的可以参考上方的官方说明。

pm list 安装包名查询

adb shell pm list package 列出所有应用adb shell pm list package -3 列出第三方应用adb shell pm list instrumentation 列出所有测试包

pm dump 打印系统信息

adb shell pm dump PACKAGE_NAME

打印服务信息解释DUMP OF SERVICE activityactivity信息DUMP OF SERVICE meminfo当前内存使用信息DUMP OF SERVICE procstats系统内存使用与一段时间内存汇总DUMP OF SERVICE usagestats服务器使用状态信息DUMP OF SERVICE batterystats电池状态信息 pm install 安装应用 pm unitall 卸载应用 pm clear 清除应用缓存


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有